update diag_manager documentation#1869
Conversation
Co-authored-by: Ryan Mulhall <35538242+rem1776@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR primarily improves documentation and Doxygen grouping across the legacy/modern diag_manager code, adds dedicated namelist documentation, and makes a small error-message correction for consistency.
Changes:
- Expanded/clarified module headers and added “legacy vs modern diag_manager” notes across multiple Fortran modules.
- Added new
diag_manager_nmlMarkdown documentation. - Minor message/documentation cleanups (e.g., updated fatal error prefix for
fms_get_domain2d).
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| diag_manager/fms_diag_yaml.F90 | Updated module brief to describe YAML object + read routines. |
| diag_manager/fms_diag_reduction_methods.F90 | Expanded module documentation; added debug-flag instructions. |
| diag_manager/fms_diag_output_buffer.F90 | Added Doxygen group annotations and clarified module brief. |
| diag_manager/fms_diag_outfield.F90 | Marked as legacy module and pointed to modern equivalents. |
| diag_manager/fms_diag_object.F90 | Corrected fatal error message to the right module/function name. |
| diag_manager/fms_diag_input_buffer.F90 | Clarified purpose (OpenMP/threaded send_data buffering). |
| diag_manager/fms_diag_file_object.F90 | Improved Doxygen docs for modern file-object module and type fields. |
| diag_manager/fms_diag_fieldbuff_update.F90 | Marked as legacy module and pointed to modern equivalents. |
| diag_manager/fms_diag_field_object.F90 | Added richer Doxygen groups/docs for modern field object module/type. |
| diag_manager/fms_diag_bbox.F90 | Minor documentation/formatting cleanup in bbox module. |
| diag_manager/fms_diag_axis_object.F90 | Significantly expanded axis/domain documentation and comments. |
| diag_manager/diag_util.F90 | Added legacy note; removed obsolete commented “FUTURE” block. |
| diag_manager/diag_table.F90 | Added legacy note pointing to modern YAML/object path. |
| diag_manager/diag_output.F90 | Added legacy note pointing to modern I/O/object path. |
| diag_manager/diag_manager_nml.md | New: Markdown documentation for diag_manager_nml variables. |
| diag_manager/diag_manager.F90 | Expanded top-level module documentation and removed embedded namelist block. |
| diag_manager/diag_grid.F90 | Added legacy note with a callout that one routine is still used by modern path. |
| diag_manager/diag_axis.F90 | Added legacy note explaining modern routing behavior. |
| diag_manager/README.md | Major expansion/restructure describing rewrite and YAML examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| !> @addtogroup fms_diag_yaml_mod | ||
| !> @{ | ||
| contains |
| public :: fmsDiagFileContainer_type | ||
| public :: fmsDiagFile_type, fms_diag_files_object_init, fms_diag_files_object_initialized | ||
| !> @} | ||
|
|
||
|
|
||
| logical :: fms_diag_files_object_initialized = .false. |
| !! @brief fms_diag_reduction_methods_mod contains routines that are used to perform diagnostic reduction methods, | ||
| !! such as max/min, average, rms, etc. These routines are called by the send_data routines in the diag_manager. | ||
| !! | ||
| !! To debug the reduction methods, compile with `-DFMS_DIAG_DEBUG_REDUCT=.true.` and the reduction routines will print | ||
| !! out the values of the buffer and field data at each time step. |
| !! @note This file is part of the legacy diag_manager. | ||
| !! If use_modern_diag is enabled, this module will be unused, as all IO will be handled | ||
| !! by the fms_diag_object.F90 module and it's helpers. |
| The modern diag manager uses a YAML format instead of the legacy ascii table. A description of the YAML diag table can | ||
| be found [here](diag_yaml_format.md). A formal specification, in the form of a JSON schema, can be found in the | ||
| [gfdl_msd_schemas](https://github.com/NOAA-GFDL/gfdl_msd_schemas) repository on Github. |
| varlist: | ||
| - var_name: var1 | ||
| output_name: variable_one | ||
| reduction: average |
| ### `use_mpp_io` | ||
| - Type: `LOGICAL` | ||
| - Default: `.FALSE.` | ||
| - Description: Selects the I/O backend: true uses `mpp_io`, false uses `fms2_io` (recommended). |
There was a problem hiding this comment.
This is not going to be an option after resolving #1881
| !! @brief diag_manager_mod is a set of simple calls for parallel diagnostics | ||
| !! on distributed systems. It is geared toward the writing of data in netCDF | ||
| !! format. See @ref diag_manager for diag table information. | ||
| !! format. The diag_manager differs from the fms2_io module in that it reads in |
There was a problem hiding this comment.
Below is not perfect, but perhaps better organized than what's here?
Diag_manager consists of tools for handling diagnostic variables in parallel on distributed systems. It uses fms2_io under the hood to write the data in NetCDF format.
Diag_manager uses the diag_table to read in all user-defined diagnostic specifications such as [fill me in with stuff like file name, write frequencies,]. This module also handles 'reduction' operations such as taking the averaging or taking the min/max of the data. [link to all reduction methods]. For example, users can send_data for a field multiple times for a timestep and the output will be 'reduced' as specified in the diag_table.
| !! The modern diag manager is enabled via the <TT>use_modern_diag</TT> flag in the <TT>diag_manager_nml</TT> | ||
| !! namelist. By default, the legacy diag manager is used to maintain backward compatibility. When | ||
| !! <TT>use_modern_diag = .true.</TT>, the modern implementation is used while maintaining the same public interfaces. | ||
| !! FMS must be built with libyaml support via the <TT>-Duse_yaml</TT> flag to use the modern diag manager. |
There was a problem hiding this comment.
for example, send_data remains the same in the modern and legacy diag_manager
| END INTERFACE | ||
|
|
||
| !> @brief Register a diagnostic field for a given module | ||
| !> @brief Register a diagnostic field for a given module, this is equivalent to creating a |
|
|
||
| The `diag_manager_nml` namelist contains runtime configuration options for the diagnostic manager. | ||
|
|
||
| Although the namelist is defined in `diag_manager_mod`, all variables belong to the `diag_data_mod` module. |
There was a problem hiding this comment.
See diag_data_mod for details
| ### `append_pelist_name` | ||
| - Type: `LOGICAL` | ||
| - Default: `.FALSE.` | ||
| - Description: If true, appends the processor element list name to output filenames. Useful for distinguishing output files from different processor configurations. |
There was a problem hiding this comment.
Is there an example of what the filename will look like?
| - is_a_file: true | ||
| ``` | ||
|
|
||
| ### 3. Scalar Axis |
There was a problem hiding this comment.
The old diag_manager adds a scalar_axis ...
| @@ -27,7 +168,7 @@ variables: | |||
| ``` | |||
| The new diag manager will no longer have a dummy scalar axis dimension. | |||
There was a problem hiding this comment.
The new diag manager no longer adds a dummy scalar axis dimension
| ### 5. Subregional Files | ||
|
|
||
| #### A. `is_subregional` global attribute: | ||
| Subregional files will have a global NetCDF attribute `is_subregional = True` set for non-global history files. This attribute will be used in PP tools. |
| @@ -80,7 +221,7 @@ In some cases, the old diag manager was adding `sub0X` to the dimension names wh | |||
| #### C. Corner and center diagnostics: | |||
| In the old diag manager, if mixing variables that are corner variables, such as velocities={uo,vo,umo,vmo} and center variables, such as tracers={thetao,so,volcello} you sometimes ended up with a different number of variables per file. The extra files had duplicate data for the corner velocities because the two PEs shared the point at the edge. This happened with some grid/layouts/masks/subregion combinations and it caused problems with the combiner. The new diag manager will not have this problem. | |||
| !! It provides helper methods for field registration, data buffering, metadata queries, | ||
| !! and NetCDF I/O support used by the diag_manager. | ||
| !! | ||
| !! The diagnostic field object is the central representation of a variable in |
There was a problem hiding this comment.
central representation => holds the main information or something like that?
There was a problem hiding this comment.
or maybe this paragraph isn't needed since it's explained later
Co-authored-by: uramirez8707 <49168881+uramirez8707@users.noreply.github.com>
Description
Updates the diag_manager documentation.
I tried to incorporate more information about which code is rewritten vs legacy code.
How Has This Been Tested?
n/a
Checklist:
make distcheckpasses